Skip to content

docs(jafar-perf): describe jfr-mcp 0.29.0 thread attribution and what jafar main changes - #23

Draft
jbachorik wants to merge 2 commits into
mainfrom
claude/confident-keller-qih9xv
Draft

jbachorik wants to merge 2 commits into
mainfrom
claude/confident-keller-qih9xv

Conversation

@jbachorik

@jbachorik jbachorik commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

The plugin pins io.btrace:jfr-mcp:0.29.0. btraceio/jafar #204, #206 and #248 changed behaviour on jafar main, and none of them is released yet (0.29.0 is still the newest version on Maven Central). This PR describes what 0.29.0 does and words each change as "from the first release after 0.29.0".

Changes

  • latency:
    • jfr_tsa on 0.29.0 files every jdk.ExecutionSample under one thread named unknown. That also breaks threadProfiles, topThreadsByState, totalThreads and the active-thread count of jfr_use. stateDistribution is unaffected.
    • Time windows: the skill now recommends epoch-nanosecond bounds, which work on both 0.29.0 and later releases. On 0.29.0 an offset startTime excludes nothing and an offset endTime excludes every event. The timeWindow epoch fields are documented as present only from the release after 0.29.0.
    • Replaced the ExecutionSample | decorateByTime(JavaMonitorWait) "what code contended" step with jfr_flamegraph on jdk.JavaMonitorEnter, jdk.JavaMonitorWait and jdk.ThreadPark. On 0.29.0 that join decorates no sample. Even after #248, JFR takes no execution sample of a waiting thread. A JDK 21 probe recorded 42 samples and 29 waits on one thread, with no sample inside a wait. jfr_flamegraph is added to the skill's allowed-tools and to concurrency-analyst's tools.
  • jfrpath:
    • decorateByTime's default thread paths, with the 0.29.0 workaround: threadPath=sampledThread/javaThreadId. The syntax template now puts thread paths before fields=, the only order 0.29.0 parses.
    • eventThread/… is null for every jdk.ExecutionSample and jdk.NativeMethodSample.
    • The query-cost (pushdown) advice applies from the release after 0.29.0.
  • gc: §5 joined execution samples with jdk.GCPhase, an event type JDK 21 does not define, on the same thread, although GC phases are recorded on GC threads. It is replaced with collector CPU from jdk.GCCPUTime.
  • cpu: thread labels in threadCounts{} come from the OS name first on 0.29.0 and the Java name first afterwards. The pointer to the removed latency decorateByTime technique now points to the jfrpath thread-path rules.
  • triage, concurrency-analyst: how to recognise a 0.29.0 TSA result with the single unknown thread. concurrency-analyst no longer points at decorateByTime correlations.
  • report: on 0.29.0, multi-chunk jfr_query and jfr_flamegraph results can be short and vary between runs (#204).

When the pin moves to a release that contains 1fe4cff, the 0.29.0 sections can be dropped.

Verification

  • validate-repository.js and validate-evals.js pass locally. validate-marketplace.sh passes locally up to its BTrace source-facts step, which needs a BTrace checkout.
  • check-tool-references.js could not run locally (no jbang in the session). CI's "Skills reference tools that exist" job, which runs it, passed on 0264fc0. Locally, every referenced tool name is also in the jfr-mcp contract snapshot at bb766fb (the day after v0.29.0) and at jafar main; the two tool sets are identical.
  • No MCP server was run to observe the behaviour. The claims about 0.29.0 and main come from the source at v0.29.0 and at 1fe4cff. Suggested smoke test on 0.29.0 with a multi-chunk jdk.ExecutionSample recording: jfr_tsa shows a single unknown thread; jfr_use/jfr_tsa with epoch bounds apply the window; jfr_flamegraph eventType=jdk.JavaMonitorWait returns stacks.

Not changed

  • jfr-analyzer also uses jfr_tsa. It is not reviewed here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Qr5KuhtdRBUtZiTzWsCcC7

… jafar main changes

The plugin pins io.btrace:jfr-mcp:0.29.0. btraceio/jafar#248 (1fe4cff) fixed
thread attribution on main, unreleased: 0.29.0 reads a sample's thread from
eventThread, which jdk.ExecutionSample and jdk.NativeMethodSample lack, so
jfr_tsa files every sample under one "unknown" thread (also totalThreads,
jfr_use's active-thread count and jfr_diagnose's TSA pass), decorateByTime
defaults to eventThread/javaThreadId on both sides, and stack profiles label
threads by OS name first. The skills now say how to recognise a 0.29.0 result
and what the first release after it does.

latency told the agent to find contending code by joining
jdk.ExecutionSample with decorateByTime(jdk.JavaMonitorWait) and to read the
undecorated rows as an uncontended baseline. On 0.29.0 that join decorates no
sample. Even with the thread fixed, JFR takes no execution sample of a waiting
thread: a JDK 21 probe with one thread alternating 100 ms of spinning and
Object.wait(100) recorded 42 samples and 29 waits on it, none of the samples
inside a wait. The skill now uses the monitor events' own stack traces.

The time-window and query-cost text from e908269 described post-0.29.0
behaviour as current. 0.29.0 compares jfr_use/jfr_tsa bounds directly with
epoch event start times (JfrAnalyses.buildTimeFilter at v0.29.0), so the
skill now recommends epoch bounds, which work on both versions, and reserves
the timeWindow epoch fields and the pushdown advice for the later release.
report notes that 0.29.0 jfr_query results on multi-chunk recordings can be
short and vary between runs (#204).

Verified: validate-repository.js and validate-evals.js pass;
validate-marketplace.sh passes up to its BTrace source-facts step, which needs
a BTrace checkout. check-tool-references.js could not run (no jbang here);
instead, every tool name the plugin references is present in the jfr-mcp
contract snapshot at bb766fb (day after v0.29.0) and at jafar main, whose
tool sets are identical. No server was run to observe the behaviour; the
0.29.0 and main claims come from the source at those revisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qr5KuhtdRBUtZiTzWsCcC7
- latency, concurrency-analyst: allow jfr_flamegraph, which the latency
  skill now calls for contending code; it was missing from allowed-tools
  and the agent's tools list.
- latency: add JavaMonitorWait and ThreadPark flame graphs next to the
  JavaMonitorEnter one, so condition waits and j.u.c parking get code paths.
  Both events carry a stackTrace (JDK 21 jfr metadata).
- gc: replace "what is running during GC", which joined execution samples
  with a jdk.GCPhase event that JDK 21 does not define, on the same thread,
  although GC phases are recorded on GC threads. Collector CPU now comes
  from jdk.GCCPUTime.
- cpu: drop the pointer to the latency decorateByTime technique this
  branch removed; point at the jfrpath thread-path rules.
- jfrpath: write the decorateByTime template with thread paths before
  fields=, which is the only order 0.29.0 parses.
- concurrency-analyst: stop pointing at decorateByTime correlations.
- report: the 0.29.0 multi-chunk caveat names jfr_flamegraph, which runs
  the same query engine as jfr_query.

Verified: validate-repository.js and validate-evals.js pass;
validate-marketplace.sh passes up to its BTrace source-facts step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qr5KuhtdRBUtZiTzWsCcC7

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants